package top.hyz.hrm;

import com.sun.istack.internal.NotNull;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @ClassName CourseDTO
 * @Description 课程
 * @Author 韩雨泽
 * @Date 2021/1/21-17:44
 * @Version 1.0
 */
@Data
@Document(indexName = "hrm", type = "course")
public class CourseDoc {

    /**
     * 课程主键id
     */
    @Id
    private Long id;

    /**
     * 课程名称
     */
    @Field(type = FieldType.Keyword, store = true)
    private String name;

    /**
     * 课程适用人群
     */
    @Field(type = FieldType.Keyword, store = true)
    private String forUser;

    /**
     * 课程类型id
     */
    @Field(type = FieldType.Long, store = true)
    private Long courseTypeId;

    /**
     * 课程类型名称
     */
    @Field(type = FieldType.Keyword, store = true)
    private String courseTypeName;

    /**
     * 课程等级id
     */
    @Field(type = FieldType.Long, store = true)
    private Long gradeId;

    /**
     * 课程等级名称
     */
    @Field(type = FieldType.Keyword, store = true)
    private String gradeName;

    /**
     * 课程所属机构id
     */
    @Field(type = FieldType.Long, store = true)
    private Long tenantId;

    /**
     * 课程所属机构名称
     */
    @Field(type = FieldType.Keyword, store = true)
    private String tenantName;

    /**
     * 课程开课时间
     */
    @Field(type = FieldType.Date, store = true)
    private Date startTime;

    /**
     * 课程结课时间
     */
    @Field(type = FieldType.Date, store = true)
    private Date endTime;

    /**
     * 封面
     */
    @Field(type = FieldType.Keyword, store = true)
    private String pic;

    /**
     * 销售量
     */
    @Field(type = FieldType.Integer, store = true)
    private Integer saleCount;

    /**
     * 浏览量
     */
    @Field(type = FieldType.Integer, store = true)
    private Integer viewCount;

    /**
     * 评论数
     */
    @Field(type = FieldType.Integer, store = true)
    private Integer commentCount;

    /**
     * 简介
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart", store = true)
    private String intro;

    /**
     * 是否收费
     */
    @Field(type = FieldType.Keyword, store = true)
    private String charge;

    /**
     * 课程售价
     */
    @Field(type = FieldType.Float, store = true)
    private Float price;

    /**
     *  查询字段
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart", store = true)
    private String searchField;
}
